package part1.language_basis.day05;

import java.util.Scanner;

//随机加法运算器
public class Addition {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int score =0;
        int result;
        int answer;
        for (int i = 1; i <=10; i++) {
            int a = (int)(Math.random()*100);
            int b = (int)(Math.random()*100);
            result = a+b;
            System.out.println("("+i+")"+a+"+"+b+"=?");
            System.out.println("算吧");
            answer = scanner.nextInt();
            if (result==-1){
                break;
            }
            if (answer==result){
                System.out.println("恭喜你答对了!");
                score += 10;
            }else{
                System.out.println("不好意思答错了!");
            }
        }
        System.out.println("总分为:"+score);
    }
}
